package com.yx.cloud.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.yx.cloud.R;
import com.yx.cloud.bean.UdpDataBean;

import java.util.List;

/**
 * 创建时间 : 2017/9/1.
 * 创建人 :
 * 功能描述 :
 */

public class WIFIListAdapter extends BaseAdapter {
    private Context mContext;
    private List<UdpDataBean> mWiFiListData;

    public WIFIListAdapter(Context context, List WiFiListData) {
        mContext = context;
        mWiFiListData = WiFiListData;
    }

    @Override
    public int getCount() {
        return mWiFiListData.size();
    }

    @Override
    public Object getItem(int position) {
        return mWiFiListData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mholder;
        if (convertView == null) {
            mholder = new ViewHolder();
            convertView = View.inflate(mContext, R.layout.wifilist_item, null);
            mholder.mSSIDNname = (TextView) convertView.findViewById(R.id.wifiList_ssidName);
            mholder.mWIFIbg = (ImageView) convertView.findViewById(R.id.wifi_iv_bg);
            convertView.setTag(mholder);
        } else {
            mholder = (ViewHolder) convertView.getTag();
        }
        UdpDataBean bean = mWiFiListData.get(position);
        mholder.mSSIDNname.setText(bean.getDevId());
        return convertView;
    }
}

class ViewHolder {
    TextView mSSIDNname;
    ImageView mWIFIbg;
}